import { ChatBase } from './chat-base';
import { UserInfo } from './user-info';

export class ChatRoom extends ChatBase {
    users: UserInfo[];

    constructor(pId:number, pUsers: UserInfo[]){
        super(pId, 'Room');
        this.users = pUsers;
        this.setDefaultName();
    }

    setDefaultName(): string {
        for (let index = 0; index < 3; index++) {
            if(index >= this.users.length){
                break;
            }
            if(index > 0){
                this.name += ',';
            }
            this.name += this.users[index].nickname;
        }
        return this.name;
    }
}
